package com.forestar.mapControl;

import android.animation.TypeEvaluator;
import android.graphics.Point;
import android.graphics.PointF;

/**
 * created by  xzk
 * 2020/7/30   14:58
 * 说明:
 */
public class PointEvaluatorimplements implements TypeEvaluator<PointF> {

    //重写evaluate()方法
    @Override
    public PointF evaluate(float fraction, PointF startValue, PointF endValue) {

        //始末值强转为Point对象
        PointF startPoint = (PointF) startValue;
        PointF endPoint = (PointF) endValue;

        //通过fraction计算当前动画的坐标值x,y
        float x = startPoint.x + fraction * (endPoint.x - startPoint.x);
        float y = startPoint.y + fraction * (endPoint.y - startPoint.y);

        //返回以上述x,y组装的新的Point对象
        PointF point = new PointF(x,y);
        return point;
    }
}
